# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=fakeroot-tcp
pkgver=1.32.1
pkgrel=1
pkgdesc="Gives a fake root environment, useful for building packages as a non-privileged user"
arch="all"
license="GPL-3.0-or-later"
url="https://packages.debian.org/fakeroot"
provides="fakeroot"
provider_priority=1
checkdepends="bash"
makedepends_build="libtool autoconf automake"
makedepends_host="libcap-dev acl-dev linux-headers"
makedepends="$makedepends_build $makedepends_host"
builddir="$srcdir/fakeroot-$pkgver"
source="https://deb.debian.org/debian/pool/main/f/fakeroot/fakeroot_$pkgver.orig.tar.gz
	fakeroot-no64.patch
	fakeroot-stdint.patch
	xstatjunk.patch
	fix-shell-in-fakeroot.patch
	fakeroot-skip-ipc-sanity-check.patch
	do-not-redefine-id_t.patch
	fix-format.patch
	"
# compared to non-tcp, this one seems to fail
options="!check"

prepare() {
	default_prepare
	CONFIG_SHELL=/bin/sh ./bootstrap
}

build() {
	# musl does not have _STAT_VER, it's really not used for
	# anything, so define it as zero (just like uclibc does)
	export CFLAGS="$CFLAGS -D_STAT_VER=0 $CFLAGS"

	CONFIG_SHELL=/bin/sh ./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static \
		--with-ipc=tcp

	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	rm -r "$pkgdir"/usr/share/man
}

sha512sums="
fe8263ca9b90e4df253311e5331721a8783260a1058b307d10ffbde47724fc24df584806b17af4477be47d90dc553abe6a476e02cf8ce2aebdd94357ff7d7f09  fakeroot_1.32.1.orig.tar.gz
7a832e6bed3838c7c488e0e12ba84b8d256e84bbb06d6020247452a991de505fa5c6bd7bcb84dce8753eb242e0fcab863b5461301cd56695f2b003fe8d6ff209  fakeroot-no64.patch
ed7a58b0d201139545420f9e5429f503c00e00f36dea84473e77ea99b23bb8d421da1a8a8ce98ff90e72e378dff4cb9ea3c1a863a969899a5f50dfac3b9c5fac  fakeroot-stdint.patch
70bf7609a5951326ac7372a252a15516f96a1ee6e458a659b16f0e4f1e2db6556482c71178d4b2f10e5ebdc0abfb7a3cc97c9878984e60cdf6e7d7281790e1fc  xstatjunk.patch
47593b3d86a66bab832c50a1d967cdc70e42bbd9ef4436f18140067ccefdd6418516e5157102c67e604f3623ed1b9f4fe1423fc5dad4dfe5356fc250c12818a7  fix-shell-in-fakeroot.patch
9a3faf924891deb36fab8f200489ad6154df262735b563dea46283afcdc83d12d32b00db33848f2a5c52d0b4422942863247577634e37b9d693f2b3a398a0f1d  fakeroot-skip-ipc-sanity-check.patch
e07162ec511c38261ad2540864f922ee03f5daa1d5d23729879c9993d62b2ffebc27eab29f3eb522ddb10b052241e58b67265914ef9100b1911948e874bf53a1  do-not-redefine-id_t.patch
481fac0b2b7388fbf8c6140311da856df1b8facfe331d04f2bc6275c766b8a81c1e07971ffd131aaf8416b8cda1f52fa4ed6d5f6ba913f69efe119288c016d78  fix-format.patch
"
